<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--
  Created by IntelliJ IDEA.
  User: sunhao
  Date: 2022/3/13
  Time: 15:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script>

</script>

<style>
    #left{
        position: absolute;
        float: left;
        top: 100px;
        left: 0px;
        
    }
    #right{
        float: left;
    position: absolute;
    top: 86px;
    left: 890px;
    }
    #showBill{
        float: left;
    position: absolute;
    top: 481px;
    left: 890px;
    }
</style>
<body >
<div>
    <div style="color: red">${requestScope.user_name}</div>
    <span>余额：${requestScope.account}元</span><br>
    <a href="${pageContext.request.contextPath}/loginout">退出</a><br>
    <a href="${pageContext.request.contextPath}/ToSubmit">成为商家！</a>

    <div id="left" >

    <div>
        <button id="button">条件查询</button>
    </div>
    <div id="search">
        <form  action="${pageContext.request.contextPath}/ShowMenu" method="get">
            <input type="text" name="user_name" value="${requestScope.user_name}" hidden>
            商家名：<input id="shop_name" name="shop_name" value="">
            商品名：<input type="text" name="name" id="name" value="">
            价格：<input type="text" name="price" id="price" value="" required>
            <select id="type" name="type">
                <option value="早餐">早餐</option>
                <option value="中餐">中餐</option>
                <option value="午餐">午餐</option>
                <option value="甜食">甜食</option>
                <option value="米">米</option>
                <option value="面">面</option>
            </select>
            <button  type="submit">提交</button>
        </form>
    </div>
<div id="showMenu">
    <table border="1" style=" border-spacing:0" >
        <tr>
            <td>id</td>
            <td>商家名</td>
            <td>商品名</td>
            <td>价格</td>
            <td>类型</td>
        </tr>
        <c:forEach var="menu" items="${requestScope.m}">
            <tr>
                <td>${menu.id}</td>
                <td>${menu.shop_name}</td>
                <td>${menu.name}</td>
                <td>${menu.price}元</td>
                <td>${menu.type}</td>
                <td><a href="${pageContext.request.contextPath}/addBill?id=${menu.id}&&user_name=${requestScope.user_name}">加入购物车</a></td>
            </tr>
        </c:forEach>

    </table>
</div>
    <br>
</div>

    <div >
    <div id="showBill"><h1>未支付订单</h1>
        <table border="1" style=" border-spacing:0" >
            <tr>
                <td>商品名</td>
                <td>商品ID</td>
                <td>用户名</td>
                <td>价格</td>
                <td>状态</td>
            </tr>
            <c:forEach var="bill" items="${requestScope.bill}">
                <tr>
                    <td hidden>${bill.id}</td>
                    <td>${bill.shop_name}</td>
                    <td>${bill.shopid}</td>
                    <td>${bill.user_name}</td>
                    <td class="price">${bill.price}元</td>
                    <td>${bill.pay}</td>
                    <td> <a href="${pageContext.request.contextPath}/Cancle?id=${bill.id}&&user_name=${bill.user_name}">取消</a></td>
                </tr>
            </c:forEach>
            <tr>

                <td colspan="3">总价</td>
                <td>${requestScope.value}元</td>

            </tr>
        </table>
        <a href="${pageContext.request.contextPath}/pay?user_name=${requestScope.user_name}&&price=${requestScope.value}&&account=${requestScope.account}">支付</a>
    </div>

    <div  id="right" >
        <h1>已支付订单</h1>

        <table border="1" style=" border-spacing:0" >
            <tr>
                <td>商品名</td>
                <td>商品ID</td>
                <td>用户名</td>
                <td>价格</td>
                <td>状态</td>
            </tr>
            <c:forEach var="billed" items="${requestScope.billed}">
                <tr>
                    <td hidden>${billed.id}</td>
                    <td>${billed.shop_name}</td>
                    <td>${billed.shopid}</td>
                    <td>${billed.user_name}</td>
                    <td class="price">${billed.price}元</td>
                    <td>${billed.pay}</td>
                </tr>
            </c:forEach>
            <td colspan="3">总价</td>
            <td>${requestScope.Billedvalue}元</td>
        </table>

    </div>

        </div>

</div>
</body>
</html>
